import request from '@/utils/request'

// 查询用户列表
export function listUser(query) {
  return request({
    url: '/user/user/list',
    method: 'get',
    params: query
  })
}

// 查询用户详细
export function getUser(id) {
  return request({
    url: '/user/user/getUserById/' + id,
    method: 'get'
  })
}

// 新增用户
export function addUser(data) {
  return request({
    url: '/user/user/addUser',
    method: 'post',
    data: data
  })
}

//开通会员
export function openMember(data) {
  return request({
    url: '/user/user/openMember',
    method: 'put',
    data: data
  })
}

//设置用户会员
export function setMember(data) {
  return request({
    url: '/user/user/setMember',
    method: 'post',
    data: data
  })
}

//修改积分
export function updateIntegral(data) {
  return request({
    url: '/user/user/updIntegral',
    method: 'post',
    data: data
  })
}

// 获取标签字典列表
export function getTagDictList() {
  return request({
    url: '/user/tagDict/getTagDictList',
    method: 'get'
  })
}

// 根据用户ID获取用户标签
export function getUserTagsByUserId(userId) {
  return request({
    url: '/user/tagDict/getTagDictListById',
    method: 'get',
    params: { userid: userId }
  })
}

// 设置用户标签
export function setUserTags(data) {
  return request({
    url: '/user/user/setUserTags',
    method: 'post',
    data: data
  })
}

// 更新用户标签 (单个和批量)
export function updateUserTags(data) {
  return request({
    url: '/user/tagDict/updTagDict',
    method: 'post',
    data: data
  })
}

// 获取用户收货地址
export function getUserShippingAddress(userId) {
  return request({
    url: '/user/address/getUserAddressById',
    method: 'get',
    params: { id: userId }
  })
}

// 获取用户会员信息
export function getUserMemberInfo(userId) {
  return request({
    url: '/user/member/getUserMemberInfo',
    method: 'get',
    params: { userId: userId }
  })
}

// 获取会员等级列表
export function getMemberLevelList() {
  return request({
    url: '/user/member/getMemberLevelList',
    method: 'get'
  })
}

